﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Freejobber.Core.Generic;

namespace Freejobber.UserControls
{
    public partial class ByteImage : System.Web.UI.UserControl
    {
        public Unit Width
        {
            get;
            set;
        }

        public Unit Height
        {
            get;
            set;
        }

        public bool Visible
        {
            get;
            set;
        }

        protected void Page_Load(object sender, EventArgs e)
        {
           
        }

        public void InitUserImage(string login)
        {
            string avatarUrl = "http://localhost:6547/images/avatars/";
            imgPhoto.ImageUrl = avatarUrl+login+".jpg";
            imgPhoto.Visible = true;

            //IImageData _data = ImageDataManager.CreateUserImageData(login);
            //Byte[] bytes = _data.GetData();
            //if (bytes != null)
            //{
            //    string base64String = Convert.ToBase64String(bytes, 0, bytes.Length);
            //    imgPhoto.ImageUrl = "data:image/png;base64," + base64String;
            //    imgPhoto.Visible = true;
            //}
        }

    }
}